<?
	$field = substr($_POST[p], 0, -1);
	$row = explode(",",$field);
	foreach($row as $k => $v){
		$sql = "UPDATE gallery_picture SET sort = $k WHERE id = $v";
		$db->execute($sql);
	}
?>